<?php
/**
 * @version $Id$
 * @package    Jmonoslideshow
 * @author     Matthieu BARBE {@link http://www.ccomca.com}
 * @author     Created on 04-Sep-2009
 */

//-- No direct access

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

class JElementSingleCategory extends JElement
{
	/**
	 * Element name
	 * @access	protected
	 * @var		string
	 */
	var	$_name = 'SingleCategory';

	function fetchElement( $name, $value, &$node, $control_name )
	{
		
		
		$sql = "SELECT `id` AS value ,`title` AS text FROM #__monoslideshow_category WHERE published = 1 ORDER BY title" ;
        
        $db =& JFactory::getDBO();
        
        $db->setQuery($sql);
        $res = $db->loadObjectList();
        if(!$res) $res = array();

		

	   return JHTML::_('select.genericlist', $res , $control_name.'['.$name.']', 'class="inputbox" size="1" ' , 'value', 'text', $value);
	}
}